//
//	ZcoModelAgent.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelAgent.h"

NSString *const kZcoModelAgentIdField = @"id";
NSString *const kZcoModelAgentUser = @"user";

@interface ZcoModelAgent ()
@end
@implementation ZcoModelAgent




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kZcoModelAgentIdField] isKindOfClass:[NSNull class]]){
		self.idField = dictionary[kZcoModelAgentIdField];
	}	
	if(![dictionary[kZcoModelAgentUser] isKindOfClass:[NSNull class]]){
		self.user = [[ZcoModelUser alloc] initWithDictionary:dictionary[kZcoModelAgentUser]];
	}

	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.idField != nil){
		dictionary[kZcoModelAgentIdField] = self.idField;
	}
	if(self.user != nil){
		dictionary[kZcoModelAgentUser] = [self.user toDictionary];
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.idField != nil){
		[aCoder encodeObject:self.idField forKey:kZcoModelAgentIdField];
	}
	if(self.user != nil){
		[aCoder encodeObject:self.user forKey:kZcoModelAgentUser];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.idField = [aDecoder decodeObjectForKey:kZcoModelAgentIdField];
	self.user = [aDecoder decodeObjectForKey:kZcoModelAgentUser];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelAgent *copy = [ZcoModelAgent new];

	copy.idField = [self.idField copy];
	copy.user = [self.user copy];

	return copy;
}
@end